package testThread.database;

import org.apache.commons.dbutils.QueryRunner;
import utils.ConnectionManager;

import java.sql.SQLException;

/**
 * @author xxx
 * @date 2021/1/12 17:35
 * @description
 */
public class DataBase {
    public  void  out(String a,double money) throws SQLException {
        QueryRunner  queryRunner=new QueryRunner();
        String s="update account set money = money - ? where name =?";
        queryRunner.update(ConnectionManager.getConnection(),s,money,a);
    }

    public  void  in(String b,double money) throws SQLException {
        QueryRunner queryRunner=new QueryRunner();
        String s="update account set money = money + ? where name =?";
        queryRunner.update(ConnectionManager.getConnection(),s,money,b);

    }
}
